************************************************
************************************************

** Replication file for
** The correlates of discord: identity, issue alignment, and political hostility in polarized America.
** Author: Lori Bougher
** Journal: Political Behavior
** Note: Replication code for ANES 2008-2009 panel data

************************************************
************************************************	

*** 2008-2009 ANES Panel
	
	*** use file panel2.dta file
		gen Dingroup=D.ingroup 
		
	*** Scale conversion
		foreach var of varlist caseid weight outgroup ingroup affpol pidstr ideostr issuealign exideo2 pint polknow2 collegegrad male repvsdem {
			su `var', meanonly  
				gen std_`var'=( `var'-r(min)) / (r(max)-r(min))
			}
			
	*** Figures and Tables
		* Table A.1
			su std_outgroup std_ingroup std_affpol std_pidstr std_ideostr std_issuealign std_exideo2 std_pint std_polknow2 std_collegegrad std_male std_repvsdem [aw=weight] if pidstr>0 & pidstr<. 		
		* Table A.2
			pwcorr std_outgroup std_ingroup std_affpol std_pidstr std_ideostr std_issuealign std_exideo2 std_pint polknow2 [aw=weight] if pidstr>0 & pidstr<. 	
		* Table 3
			reg D(std_outgroup std_pidstr std_ideostr std_issuealign std_exideo2 std_pint) [aw=weight] if Dingroup<., vce (cluster caseid) nocons 
				** note: excludes two observations missing Dingroup for consistency of sample, results unchanged with their inclusion
			reg D(std_ingroup std_pidstr std_ideostr std_issuealign std_exideo2 std_pint) [aw=weight], vce (cluster caseid) nocons
		* Table A.4 Fixed effects 
			xtreg std_outgroup std_pidstr std_ideostr std_issuealign std_exideo2 std_pint [aw=weight], vce (cluster caseid) fe
			xtreg std_ingroup std_pidstr std_ideostr std_issuealign std_exideo2 std_pint [aw=weight], vce (cluster caseid) fe
